import { Component, EventEmitter } from '@angular/core';

import { TableTab } from '../interface-shared';

@Component({
  selector: 'table-tab',
  templateUrl: 'table-tab.component.html',
  styleUrls: ['table-tab.component.less'],
  inputs: ['lists'],
  outputs: ['tableToggle']
})

export class TableTabComponent {
  lists: any[];
  tableToggle = new EventEmitter<number>();
  currentTabIndex = 0;
  constructor () {}

  tabClick (id, className) {
    this.currentTabIndex = id;
    this.tableToggle.emit(className);
  }

  tabActive (id) {
    return id === this.currentTabIndex;
  }

  trackByTab (index: number, tab:TableTab) {
    return tab.class
  }
}